<template>
	<view class="wrap app_bottomSafeArea">
		<view class="store app_flex-aic bw">
			<view class="store-img">
				<image :src="netHotInfo.logoImg"></image>
			</view>
			<view class="store-R">
				<view class="store-name">{{netHotInfo.shopName}}</view>
				<view class="store-date">{{netHotInfo.createDate}}</view>
			</view>
		</view>
		<view class="swiper">
			<!-- <u-swiper height="800" :list="list" border-radius="0" :autoplay="false"></u-swiper> -->
			<swiper :indicator-dots="true">
				<swiper-item v-for="(item, index) in list" :key="index">
					<view class="mvba">
						<view class="mvbv1" v-for="(val, idx) in item.points" :key="idx"
							:style="{left: `${val.x}px`, top: `${val.y}px`}">
							<view class="dot"></view>
							<view class="item" @click="onSkipTap('goodsDetail', val.products[0].id)">
								<view class="image">
									<image src="../../static/images/icon-shoppackWhite.png" mode=""></image>
								</view>
								<text class="app_ellipsis">{{val.products[0].productName}}</text>
							</view>
						</view>
						<view class="mvbv2"
							:style="{width: `750rpx`, height: `750rpx`, backgroundImage: `url(${item.url})`}"
							@click="previewImg(item.url)">
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="article">
			<view class="article-header app_flex-aicjcsb">
				<view class="pageView app_flex-aic">
					<image src="../../static/images/icon-pv.png"></image>
					<text>{{netHotInfo.browseAmount}}</text>
				</view>
				<view class="share">
					<image src="../../static/images/icon-share.png"></image>
				</view>
			</view>
			<view class="article-main">{{netHotInfo.describe}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				netHotInfo: {},
				list: [],
			}
		},
		onLoad(options) {
			this.id = options.id
			this.updatePage()
		},
		methods: {
			updatePage() {
				this.getDetail()
			},
			onSkipTap(type, params) {
				let urlObj = {
					goodsDetail: () => {
						uni.navigateTo({
							url: `/pages/shopInfo/goodsDetail?id=${params}`
						})
					}
				}
				this.$g_util.navigationTo(urlObj, type)
			},
			getDetail() {
				this.$g_api.productDetailNethot({
					nethotId: this.id
				}).then(({
					data
				}) => {
					data.logoImg = this.$g_util.concatRequestUrl(data.logoImg)
					this.netHotInfo = data
					this.list = data.images.map(item => {
						item.url = this.$g_util.concatRequestUrl(item.url)
						item.points = item.points.map(val => {
							val.point = val.point.split(',')
							val.x = val.point[0]
							val.y = val.point[1]
							return val
						})
						return item
					})
				})
			},
			previewImg(current) {
				uni.previewImage({
					current,
					urls: this.list.map(item => {
						return item.url
					})
				})
			}
		}
	}
</script>
<style>
	page {
		background-color: #fff;
	}
</style>
<style scoped lang="scss">
	.store {
		height: 110rpx;
		padding: 0 30rpx;
	}

	.store-img {
		font-size: 0;

		image {
			width: 70rpx;
			height: 70rpx;
			margin-right: 20rpx;
			border-radius: 50%;
			background-color: #ccc;
		}
	}

	.store-R {}

	.store-name {
		margin-bottom: 6rpx;
		font-size: 30rpx;
	}

	.store-date {
		font-size: 20rpx;
		color: #999;
	}

	.swiper {}

	swiper {
		width: 750rpx;
		height: 750rpx;
	}

	.mvba {
		position: relative;
		width: 750rpx;
		height: 750rpx;
	}

	.mvbv1 {
		position: absolute;
		display: flex;
		align-items: center;
		width: 300rpx;
		max-width: 450rpx;
		z-index: 999;

		.dot {
			flex-shrink: 0;
			display: block;
			width: 8rpx;
			height: 8rpx;
			border-radius: 50%;
			background-color: #fff;
			box-sizing: content-box;
			border: 8rpx solid rgba(0, 0, 0, .6);
		}

		.item {
			display: flex;
			align-items: center;
			min-height: 40rpx;
			margin-left: 10rpx;
			padding: 0 0 0 10rpx;
			border-radius: 20px 4px 4px 20px;
			background-color: rgba(0, 0, 0, .6);

			.image {
				font-size: 0;

				image {
					width: 18rpx;
					height: 20rpx;
				}
			}

			text {
				max-width: 266rpx;
				padding: 0 12rpx 0 14rpx;
				font-size: 20rpx;
				color: #fff;
			}
		}
	}

	.mvbv2 {
		background-size: 100% 100%;
		// background-color: red;
		z-index: 99;
	}

	.article {
		padding: 40rpx 30rpx 40rpx;
	}

	.article-header {
		margin-bottom: 24rpx;
	}

	.pageView {
		font-size: 0;

		image {
			width: 30rpx;
			height: 22rpx;
		}

		text {
			margin-left: 8rpx;
			font-size: 24rpx;
			color: #999;
		}
	}

	.share {
		image {
			width: 38rpx;
			height: 38rpx;
		}
	}

	.article-main {}
</style>
